from typing import *
class Solution:
    def tupleSameProduct(self, nums: List[int]) -> int:
        n = len(nums)
        h = DefaultDict(int)
        ans = 0
        for i in range(n):
            a = nums[i]
            for j in range(i + 1,n):
                b =nums[j]
                s = a * b
                ans += (h[s] << 3)
                h[s] += 1
        return ans